<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Datei: pagepointer.class.php
 *
 * Create, set, delete pagepointer ,in link-format,
 * for navigate with previus page / next page / back eg.
 *
 * @author Norbert Gebert
 * @copyright Norbert Gebert 08.02.2014
 * @license GPL3
 *
 * @version 0.5b
 * @package Admin
 * @subpackage global
 */
class pagepointer
{

	// @var $text String Text from the last called message
	static $pagePointer = '';

	/**
	 * Initializes the system-variable if still not available. 
	 */
	function __construct()
	{
		if (!isset($_SESSION['nextPagex']))
		// @var $nextPage string pointer to next page if availiable
			$_SESSION['nextPagex'] = '';

		if (!isset($_SESSION['previousPagex']))
		// @var $previousPage string to previous page
			$_SESSION['previousPagex'] = '';

		if (!isset($_SESSION['pageTablex']))
		// @var $pageTable array with links to next / previous pages eg. to list products
			$table = array();
		$_SESSION['pageTablex'] = '';

		if (!isset($_SESSION['lastPagex']))
		// @var $lastPage string to previous page
			$_SESSION['lastPagex'] = '';

		if (!isset($_SESSION['currentPagex']))
		// @var $currentPage string to previous page
			$_SESSION['currentPagex'] = '';
	}

	/**
	 * setting previous page
	 */
	public static function setCurrentPage()
	{
		$_SESSION['lastPagex'] = $_SESSION['currentPagex'];
		$_SESSION['currentPagex'] = '/index.php?' . $_SERVER['QUERY_STRING'];
	}
	
	/**
	 * get last page
	 */
	public static function getLastPage()
	{
		return $_SESSION['lastPagex'];
	}
	
	/**
	 * get page
	 */
	public static function getBackPage()
	{
		return $_SESSION['currentPagex'];
	}

}

?>